#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> P;

struct Go {
    P a[5];
    bool eq() {
        int x = a[0].second;
        for (int i=1; i<5; ++i)
            if (a[i].second != x)
                return false;
        return true;
    }

    bool seq() {
        sort(a, a+5);
        int x = a[0].first;
        for (int i=1; i<5; ++i)
            if (a[i].first != x + i)
                return false;
        return true;
    }

    vector<P> mCard() {
        vector<P> res;
        for (int i=0, j; i<5; i=j+1) {
            j = i;
            while (a[j+1].first == a[i].first)
                ++j;
            res.push_back(make_pair(j-i+1, a[i].first));
        }
        return res;
    }

    P cType() {
        bool b1 = eq(), b2 = seq();
        // P res;
        // res.second = a[4].first;
        auto vm = mCard(), m = vm.back();
        if (b1 && b2) {
            return make_pair(9, a[4].second)
        } else if (m.first == 4) {
            return make_pair(8, m.second);
        } else if (m.first == 3 && vm.size() > 1) {
            return make_pair(7, m.second * 100 + vm[0].second);
        } else if (b1) {
            return make_pair(6, a[4].second);
        } else if (b2) {
            return make_pair(5, a[4].second);
        } else if 
    }
    bool operator < (const Go &other) const {

    }
};

bool firstWin(P a[]) {

}


void solve() {

}

int main(int argc, char const *argv[])
{
    int t;
    scanf("%d", &t);
    while (t--)
        solve();
    return 0;
}